package com.hu;


import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: one
 * @description: 自动
 * @author: Mr.Hu
 * @create: 2019-08-31 21:41
 */
@Configuration
@ConditionalOnClass(Girl.class)
@EnableConfigurationProperties(GirlProperty.class)
public class GirlAutoConfig {

    @Bean("girl")
    @ConditionalOnMissingBean
    public Girl girl(GirlProperty girlProperty){
        Girl girl = new Girl();
        girl.setName(girlProperty.name);
        girl.setLength(girlProperty.length);
        return girl;
    }
}
